//
//  mm_addPartListToIndicationUserDefinedCell.m
//  HondaPro_2
//
//  Created by Eric on 13-7-16.
//  Copyright (c) 2013年 glendale. All rights reserved.
//

#import "mm_addPartListToIndicationUserDefinedCell.h"

@implementation mm_addPartListToIndicationUserDefinedCell
@synthesize arrAllKeysOnCell = _arrAllKeysOnCell;
@synthesize dicAllLblsOnCell = _dicAllLblsOnCell;

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        
        [self initLblsOnCell];
    }
    return self;
}

-(void)initLblsOnCell
{
    self.arrAllKeysOnCell = [NSArray arrayWithObjects:
                             @"STORAGE_CODE",
                             @"PART_NO",
                             @"PART_NAME",
                             @"USEABLE_STOCK",
                             @"SALES_PRICE",
                             nil];
    
    NSDictionary *dicAllLblsRect = [NSDictionary dictionaryWithObjectsAndKeys:
                                    [NSValue valueWithCGRect:CGRectMake(0, 0, 239, 50)],@"STORAGE_CODE",
                                    [NSValue valueWithCGRect:CGRectMake(240, 0, 152, 50)],@"PART_NO",
                                    [NSValue valueWithCGRect:CGRectMake(393, 0, 305, 50)],@"PART_NAME",
                                    [NSValue valueWithCGRect:CGRectMake(698, 0, 100, 50)],@"SALES_PRICE",
                                    [NSValue valueWithCGRect:CGRectMake(798, 0, 124, 50)],@"USEABLE_STOCK",
                                    nil];
    
    self.dicAllLblsOnCell = [NSMutableDictionary dictionaryWithCapacity:[_arrAllKeysOnCell count]];
    
    for (int i = 0; i<[_arrAllKeysOnCell count]; i++)
    {
        NSString *strKey = [_arrAllKeysOnCell objectAtIndex:i];
        CGRect rect = (CGRect)[[dicAllLblsRect objectForKey:strKey] CGRectValue];
        UILabel *lbl = [[UILabel alloc] initWithFrame:rect];
        lbl.backgroundColor = [UIColor clearColor];
        lbl.font = [UIFont systemFontOfSize:16];
        lbl.textColor = [UIColor grayColor];
        lbl.textAlignment = NSTextAlignmentCenter;
        [self.dicAllLblsOnCell setObject:lbl forKey:strKey];
        [self addSubview:lbl];
    }
}

@end
